/***************************************************************************
 *   Copyright (C) 2007 by Igor Lyubimov   *
 *   mr_july@mail.ru   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#include "translitpairlist.h"

TranslitPairList TranslitPairListHelper::fromQStringList(QStringList sl)
{
  TranslitPairList tpl;
  for (QStringList::iterator it = sl.begin();it != sl.end(); it++) {
    //QString sPair = new QString((QString)sPair);
    QStringList pair = QStringList::split( '=', (*it) );
    TranslitPair* tp = new TranslitPair(pair[0], pair[1]);
    tpl.append((TranslitPair)(*tp));
    delete tp;
  }
  qHeapSort(tpl);
  return tpl;
};

QStringList TranslitPairListHelper::toQStringList(TranslitPairList tpl)
{
  QStringList sl;
  //QValueList<TranslitPair>::iterator iter;
  TranslitPairList::iterator iter;
  for (iter = tpl.begin(); iter != tpl.end(); iter++) {
    QStringList pair;
    pair.append((*iter).first);
    pair.append((*iter).second);
    sl += pair.join("=");
  }
  return sl;
};
